import { bindable, containerless } from 'aurelia-framework';

@containerless
export class EmTaskDetail {

    @bindable value;

    valueChanged(newValue, oldValue) {

    }

    /**
     * 构造函数
     */
    constructor() {
        this.subscribe = ea.subscribe(nsCons.EVENT_TASK_SELECTED_CHANGED, (payload) => {
            // this.task = payload;
        });
    }


    bind(bindingCtx, overrideCtx) {
        $.get(`/admin/task/get/27`, {

        }, (data) => {
            if (data.success) {
                this.task = data.data;
            } else {
                toastr.error(data.data);
            }
        });
    }

    /**
     * 当数据绑定引擎从视图解除绑定时被调用
     */
    unbind() {
        this.subscribe.dispose();
    }
}
